package com.unicom.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.unicom.model.User;
import com.unicom.service.UserService;

@Controller
public class UserController {
	
	@Autowired
	private UserService userService;
	
	
	@RequestMapping("/findAll")
	@ResponseBody
	public List<User> findAllUsers(){
		return userService.getall();
	}
	
	@RequestMapping("/addUser")
	@ResponseBody
	public String addUser(){
		User user = new User();
		user.setUsername("111111");
		user.setSex("1");
		userService.addUser(user);
		return "ok";
	}
	
	
}
